<?php


namespace app\admin\controller\virtual;


use think\Request;
use app\admin\model\PushStore as PushStoreModel;

class PushStore
{

    public function list(Request $request)
    {
        $key = $request->param("key");
        $staffNo = $request->param("staff_no");
        $res = PushStoreModel::list($key,$staffNo);
        return successJson("success",$res);
    }

    public function add(Request $request)
    {
        $url = $request->param("url");
        $user = $request->_user;
        $res = PushStoreModel::add($url,$user["staff_no"],$user["staff_name"]);
        if($res){
            return failedJson($res);
        }
        return successJson("success","成功~");
    }

    public function getGwShopCheckedId(Request $request)
    {
        $url = $request->param("url");
        $user = $request->_user;
        $res = PushStoreModel::add($url,$user["staff_no"],$user["staff_name"],'get_info');
        $checked_id = PushStoreModel::$shopChecked[$res['checked_id']]['text'];
        return successJson("success", $checked_id);
    }



    public function del(Request $request)
    {
        $id = $request->param("id");
        PushStoreModel::del($id);
        return successJson("success");
    }
}